from svn.remote import RemoteClient
from util.exception import ValidationError
import traceback
import pysvn
# from django.conf import settings
import os
from collections import OrderedDict


# svn_url = "svn://192.168.2.12/software/DeviceManagementSystem/trunk/hd/pingtai_docker/zhengshi/t_use"
# svn_url = "svn://192.168.2.12/software/DeviceManagementSystem/trunk/hd"
svn_url = "svn://192.168.2.12/publish"
# svn_url = "svn://192.168.2.12/software"
# svn_url = "svn://192.168.2.12/software"

username = "publisher"
password = "U6cdF*_bo#ix*i33"
svn = RemoteClient(svn_url, username=username, password=password)
# a = svn.run_command(subcommand="list", args=[svn_url])
logs = svn.run_command(subcommand="log", args=[svn_url])
cut_logs = []
for i in logs:
    if i:
        if i.startswith("svn"):
            continue
        elif i.startswith("-"):
            continue
        elif i.__contains__("|"):
            continue
        else:
            cut_logs.append(i)
msg = cut_logs[0]
print(msg)

# # svn_url = "svn://192.168.2.12/software/DeviceManagementSystem/trunk/hd/pingtai_docker/zhengshi/t_use"
# # svn_url = "svn://192.168.2.12/software/DeviceManagementSystem/trunk/hd"
# svn_url = "svn://192.168.2.12/software/DeviceManagementSystem/trunk"
# # svn_url = "svn://192.168.2.12/software"
# # svn_url = "svn://192.168.2.12/software"
# username = "wuxl"
# password = "KR#O&mz80xpSBSUs".format().encode()
# # password = "U6cdF*_bo#ix*i33".format().encode()
# svn = RemoteClient(svn_url, username=username, password=password)
# a = svn.run_command(subcommand="log", args=["svn://192.168.2.12/software/DeviceManagementSystem/trunk/hd"])
# print(a)
# b = []
# for i in a:
#     if i:
#         if i.startswith("---"):
#             pass
#         else:
#             b.append(i)
# c = b[0].split("|")
# print(c)
#
